<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<?php include("include/header.php");?>
<card id="index" title="<?php echo $info->name; ?> | <?php echo $info->description; ?>">
<?php echo $this->setting->blogname; ?><br/>
<?php echo $this->setting->blogdescription; ?><br/>
<?php echo $nav; ?><br/><br/>
<?php
$i = 0;
foreach($posts->Data AS $key => $post) {
	$i++;
	$key = ($this->setting->posts_per_page * ($posts->CurrentPage - 1)) + $i;
	$k = array();
	foreach((array)$this->cache->get_term_by_id($post->ID, 'category') as $category) {
		$k[] = "<a href=\"".$this->url('category', $category->ID)."\">" . $category->name . "</a>"; 
	}
?>
<?php if($i == 1 && ($this->query->is_category || $this->query->is_date || $this->query->is_tag || $this->query->is_search || $this->query->is_author)) { ?>
【<?php echo strtoupper($info->type) . ":" . $info->name; ?>】<br/>
<?php } ?>
<?php if($i==1) {?>
-------------------<br/>
<?php } ?>
<a href="<?php echo $this->url('post', $post->ID); ?>"><?php echo $key . '.' . $post->title; ?>[<?php echo date('Y/m/d',$post->time); ?>]</a><br/>
<?php
	if($post->password=='' || $this->check_post_password($post->ID)) {
		$content = $this->wapSubString($post->content, 100);
		$content = preg_replace('/\[PHOTO\]/i', '[图片]', $content);
		$content = preg_replace('/\[ALBUM\]/i', '[相册]', $content);
		$content = preg_replace('/\[OBJECT\]/i', '[视频/音频]', $content);
		echo $content;
	} else {
		include("include/password.php");
	}
?><br/>
分类 <?php echo implode(',', $k); ?> | <a href="<?php echo $this->url('post', $post->ID); ?>"><?php if($post->comment > 0) { ?><?php echo $post->comment; ?>条<?php } else { ?>没有<?php } ?>评论</a><br/>
-------------------<br/>
<?php } ?>

<?php
if($pager->getTotalpage() > 1) {
	echo "分页:"; 
	$pager->prevWords = array('text'=>'上一页','title'=>'');
	$pager->nextWords = array('text'=>'下一页','title'=>'');
	$pager->render();
}?><br/><br/>

【分类】<br/><?php
function category_children($mm, $i) {
	$str = "";
	$i++;
	foreach($mm as $key => $cat) {
		if($cat->count > 0 || !empty($cat->children)) {
			$str .= str_repeat('－', $i) . "<small><a href=\"".$cat->url."\">" . $cat->name . "(" . $cat->count . ")</a></small><br/>\n";
		}
		if(!empty($cat->children)) $str .= category_children($cat->children, $i);
	}
	return $str;
}

$i = 0;
foreach($this->cache->get_term_by_name('category') as $key => $cat) {
	if($cat->count > 0 || !empty($cat->children)) {
		echo "<a href=\"" . $cat->url . "\">" . $cat->name . "(" . $cat->count . ")</a><br/>\n";
	}
	if(!empty($cat->children)) echo category_children($cat->children, $i);
}
?><br/><br/>

【标签】<br/>
<?php
$k = array();
foreach($this->merge_tag_font_size($this->cache->get_term_by_name('post_tag')) as $row) {
	if($row->count > 0)
	$k[] = "<a href=\"".$row->url."\">".$row->name."</a>";
}
echo implode(',', $k);
?><br/><br/>

【搜索】<br/>
<input type="text" maxlength="10" emptyok="false" name="s" width="98%" />
<anchor>确定<go href="<?php echo $this->url('home'); ?>/" method="get"><postfield name="s" value="$s" /></go></anchor><br/>
<?php include("include/footer.php");?>
</card>
</wml>